<?php /* Smarty version 2.6.18, created on 2016-11-30 17:48:55
         compiled from achieve/achieve.add.tpl.php */ ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "index.header.tpl.php", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<link rel="stylesheet" href="static/css/select2.css">
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "index.left.tpl.php", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

  <!--主要内容开始-->
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
        <section class="col-lg-12 connectedSortable">
         <div class="box box-default box-solid">
             <form name="myform" action="" method="post" role="form" enctype="multipart/form-data">
                <div class="box-header with-border">
                    <span class="fa fa-pencil" style="float:left; font-size:18px; padding-top:3px; color:#3c8dbc;" ></span>
                    <p class="box-title">教学成果添加</p>
                </div>
                <div class="box-body">
					<input type="hidden" name="achieve_type" value="<?php echo $this->_tpl_vars['type']; ?>
">
				   <div class="form-group">
						  <label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							   获奖名称：
						  </label>
						  <div class="input-group col-md-6 col-sm-12 col-xs-12">
							   <input type="text" name="achieve_name" class="form-control" required="required">
						  </div> 
				    </div>
					<?php if ($this->_tpl_vars['type'] == 6): ?>
					<div class="form-group">
						<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							出版社：
						</label>
						<div class="input-group col-md-6 col-sm-12 col-xs-12">
							<select class="form-control" id="s1" onchange="a()" name="achieve_publish">
								<option value=""> 请选择</option>
								<?php $_from = $this->_tpl_vars['publish_lists']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
								<option value="<?php echo $this->_tpl_vars['value']['publish_id']; ?>
"><?php echo $this->_tpl_vars['value']['publish_name']; ?>
</option>
								<?php endforeach; endif; unset($_from); ?>
								<option value="自定义"> 自定义</option>
							</select>
							<input id="new" class="form-control" placeholder="添加新的" name="resttype_name">
							<span class="btn btn-default" id="add">添加</span>
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							书号：
						</label>
						<div class="input-group col-md-6 col-sm-12 col-xs-12">
							<input type="text" name="achieve_bookno" class="form-control" required="required">
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							所在页：
						</label>
						<div class="input-group col-md-6 col-sm-12 col-xs-12">
							<input type="text" name="achieve_page" class="form-control" required="required">
						</div>
					</div>
					<?php endif; ?>
					<?php if ($this->_tpl_vars['type'] != 6): ?>
					<div class="form-group">
						  <label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							   主办单位：
						  </label>
						  <div class="input-group col-md-6 col-sm-12 col-xs-12">
							   <input type="text" name="achieve_unit" class="form-control" required="required">
						  </div> 
				    </div>
					<?php if ($this->_tpl_vars['type'] != 7): ?>
					<div class="form-group">
						<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							获奖名次：
						</label>
						<div class="input-group col-md-6 col-sm-12 col-xs-12">
							<select class="form-control" name="achieve_rank">
								<?php $_from = $this->_tpl_vars['prize']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
								<option value="<?php echo $this->_tpl_vars['value']['prize_id']; ?>
"> <?php echo $this->_tpl_vars['value']['prize_name']; ?>
</option>
								<?php endforeach; endif; unset($_from); ?>
							</select>
						</div>
					</div>
					<?php else: ?>
					<div class="form-group">
						<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							第一指导老师：
						</label>
						<div class="input-group col-md-6 col-sm-12 col-xs-12">
							<select class="form-control" name="achieve_teach">
								<?php $_from = $this->_tpl_vars['teachers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
								<option value="<?php echo $this->_tpl_vars['value']['staff_id']; ?>
"> <?php echo $this->_tpl_vars['value']['staff_name']; ?>
(<?php echo $this->_tpl_vars['value']['staff_number']; ?>
)</option>
								<?php endforeach; endif; unset($_from); ?>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							本人名次：
						</label>
						<div class="input-group col-md-6 col-sm-12 col-xs-12">
							<input type="text" name="achieve_trank" class="form-control" required="required">
						</div>
					</div>
					<?php endif; ?>
					<?php endif; ?>
					<div class="form-group">
						  <label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							   获奖级别：
						  </label>
						<div class="input-group col-md-6 col-sm-12 col-xs-12">
							<select class="form-control" name="achieve_lv">
								<?php $_from = $this->_tpl_vars['prizelv']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
								<option value="<?php echo $this->_tpl_vars['value']['prizelv_id']; ?>
"> <?php echo $this->_tpl_vars['value']['prizelv_name']; ?>
</option>
								<?php endforeach; endif; unset($_from); ?>
							</select>
						</div>
				    </div>

					<div class="form-group">
						  <label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							   <?php if ($this->_tpl_vars['type'] == 6): ?>发表者<?php else: ?>获奖人<?php endif; ?>：
						  </label>
						<div class="input-group col-md-6 col-sm-12 col-xs-12">
							<?php if ($this->_tpl_vars['type'] == 5): ?><input type="text" name="achieve_owner" id="achieve_owner" class="form-control" required="required">
							<?php else: ?><select class="form-control" name="achieve_owner">
								<?php $_from = $this->_tpl_vars['teachers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
								<option value="<?php echo $this->_tpl_vars['value']['staff_id']; ?>
"> <?php echo $this->_tpl_vars['value']['staff_name']; ?>
(<?php echo $this->_tpl_vars['value']['staff_number']; ?>
)</option>
								<?php endforeach; endif; unset($_from); ?>
							</select><?php endif; ?>
						</div>
					</div>

					<div class="form-group">
						  <label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							  <?php if ($this->_tpl_vars['type'] == 6): ?>发表日期<?php else: ?>获奖日期<?php endif; ?>：
						  </label>
						  <div class="input-group col-md-6 col-sm-12 col-xs-12">
							       <input type="text" class="form-control" name="achieve_time"  id="datepicker" />
                                   <div class="input-group-addon">
                                      <i class="fa fa-calendar"></i>
                                  </div>
						  </div> 
				    </div>
					<?php if ($this->_tpl_vars['type'] == 5): ?>
					<div class="form-group">
						<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							第一指导老师：
						</label>
						<div class="input-group col-md-6 col-sm-12 col-xs-12">
							<select class="form-control" name="achieve_teach">
								<?php $_from = $this->_tpl_vars['teachers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
								<option value="<?php echo $this->_tpl_vars['value']['staff_id']; ?>
"> <?php echo $this->_tpl_vars['value']['staff_name']; ?>
(<?php echo $this->_tpl_vars['value']['staff_number']; ?>
)</option>
								<?php endforeach; endif; unset($_from); ?>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							其他指导老师：
						</label>
						<div class="input-group col-md-6 col-sm-12 col-xs-12">
							<select class="form-control select2" name="achieve_teachers[]" multiple="multiple" data-placeholder="选择老师（可多选）">
								<?php $_from = $this->_tpl_vars['teachers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
								<option value="<?php echo $this->_tpl_vars['value']['staff_id']; ?>
"> <?php echo $this->_tpl_vars['value']['staff_name']; ?>
(<?php echo $this->_tpl_vars['value']['staff_number']; ?>
)</option>
								<?php endforeach; endif; unset($_from); ?>
							</select>
						</div>
					</div> 
					<?php endif; ?>
					<div class="form-group">
						  <label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							   备注：
						  </label>
						<div class="input-group col-md-6 col-sm-12 col-xs-12">
							<input type="text" name="achieve_remark" class="form-control" required="required">
						</div>
				    </div>
					<div class="form-group">
						  <label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							   附件：
						  </label>
						  <div class="input-group col-md-6 col-sm-12 col-xs-12">
							   <input type="file"  name="achieve_file" multiple="multiple">
						  </div> 
				    </div>
					<?php if ($this->_tpl_vars['type'] == 5): ?>
					<div class="form-group">
						<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
							是否同步到指导老师奖：
						</label>
						<div class="input-group col-md-6 col-sm-12 col-xs-12">
							<input type="checkbox" name="same">
						</div>
					</div>
					<?php endif; ?>
				</div><!--box-body --> 
                <div class="box-footer text-center">
                     <button class="btn btn-primary" type="submit">保 存 信 息</button>
                 </div>
             </form>
           </div><!--box box-default box-solid-->
        </section>   
           
        </div><!--row-->
    </section>
 </div>
<!--主要内容结束-->   
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "index.footer.tpl.php", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
  <script>
  $(function() {
    $( "#datepicker" ).datepicker({
      showOtherMonths: true,
      selectOtherMonths: true,
	  changeMonth: true,
      changeYear: true,
    });
	$( "#datepicker1" ).datepicker({
      showOtherMonths: true,
      selectOtherMonths: true,
	  changeMonth: true,
      changeYear: true
    });
	$( "#datepicker2" ).datepicker({
      showOtherMonths: true,
      selectOtherMonths: true,
	  changeMonth: true,
      changeYear: true
    });
	$( "#datepicker3" ).datepicker({
      showOtherMonths: true,
      selectOtherMonths: true,
	  changeMonth: true,
      changeYear: true
    });
  });
  //上传图片
  $(function(){
        var imgurl=[];
        function createfile(){
        $('#updiv').append("<input type='file'  name='photos' class='upfile'>");
        }
        function showimg(url){
            var img='<img src="'+url+'"/>';
            $('#imglist').append(img);
        }
        function addfile(){
            showimg($(this).val());
            $(this).hide();
            createfile();
            $('.upfile').bind('change',addfile);
        }
        $('.upfile').bind('change',addfile);
    })
</script>
<?php if ($this->_tpl_vars['type'] == 5): ?>
<script>
	$(function (){
		$('#achieve_owner').blur(function(){
			var name = $('#achieve_owner').val();
			$.post('index.php?a=achieve.checks',{name:name},function ($data) {
				if($data == 0){alert('未找到相应学生');}
			});
		})
	})
</script>
<?php endif; ?>

<?php if ($this->_tpl_vars['type'] == 6): ?>
<script type="text/javascript">
	$(document).ready(function(){
		$("#new").hide();
		$("#add").hide();

		$("#add").click(function(){
			var na=$("#new").val();
			$.ajax({
				url:"index.php?a=publish.addajax&name="+na,
				type:"get",
				dataType: "json",
				success: function (msg) {
					//alert(msg);
					if(msg!=""){
						$("#s1").append("<option value='"+msg+"'>"+$("#new").val()+"</option>");
						$("#new").val('');
					}
				}
			});
		});
	});
	function a()
	{
		var val = $("#s1").val();
		if (val == '自定义') {
			$("#new").show();
			$("#add").show();
		} else{
			$("#new").hide();
			$("#add").hide();
		};
	}
</script>
<?php endif; ?>
<script src="static/js/select2.min.js"></script>
 <script>
  $(function() {
    $(".select2").select2();
  });
  </script>